#include <stdio.h>

/*int main()
{
	int tomorrowis520canyoubemygirlfriend = 1;
	int* point = &tomorrowis520canyoubemygirlfriend;
	int** point2 = &point;
	int*** point3 = &point2;
	int**** point4 = &point3;
	****point4 = 0;
	printf("%d\n",****point4);
	printf("%d\n",***point3);
	return 0;
}*/

struct person
{
	char favoritefruit;
	int likemen;
	struct person* father;
	struct person* lover;
	char gender;
};

void printloverloop(struct person*p) {
	while (1)
	{
		if(p!=NULL){
			printf("%c\n",(*p).favoritefruit);
			getchar();
		} else {
			break;
		}
		p = (*p).lover;
	}
}

void printspecialpeople(struct person*p) {
	while (1)
	{
		if(p!=NULL) {
			printf("%c %d\n",(*p).gender,(*p).likemen);
			if(((*p).lover!=NULL)&&((*p).gender == (*((*p).lover)).gender)) {
				printf("%c\n",(*p).favoritefruit);
			}
		} else {
			break;
		}
		p = (*p).lover;
	}
}

int main()
{
	struct person zzz;
	struct person zmx;
	struct person zdf;
	struct person zty;
	struct person yyz;
	zdf.favoritefruit = 'c';
	zdf.likemen = 0;
	zdf.father = &zzz;
	zdf.lover = &zmx;
	zdf.gender = 'm';
	struct person znn;
	znn.favoritefruit = 'c';
	znn.likemen = 1;
	znn.father = &zdf;
	znn.lover = NULL;
	znn.gender = 'f';
	struct person zxy;
	zxy.favoritefruit = 'o';
	zxy.likemen = 1;
	zxy.lover = &znn;
	zxy.father = NULL;
	zxy.gender = 'f';
	struct person ywb;
	ywb.favoritefruit = 'i';
	ywb.likemen = 1;
	ywb.father = NULL;
	ywb.lover = &zxy;
	ywb.gender = 'f';
	struct person gyy;
	gyy.favoritefruit = 'g';
	gyy.likemen = 0;
	gyy.father =NULL;
	gyy.lover = &yyz;
	gyy.gender = 'f';
	yyz.favoritefruit = 'p';
	yyz.likemen = 1;
	yyz.father = NULL;
	yyz.lover = &ywb;
	yyz.gender = 'm';
	//printloverloop(&gyy);
	printspecialpeople(&gyy);
	return 0;
}

/*int main ()
{
	int person = 1;
	int* person2 = &person;
	int** person3 = &person2;
	**person3 = 0;
	int ***person4 = &person3;
	*person3 = person4;
}*/